using I2.Loc;
using UnityEngine;

public class WindowNewMission : MonoBehaviour
{
	private MissionBase curMission;

	public UILabel lbTitleMis;

	public UILabel lbPurposMis;

	public UILabel lbManualMis;

	public UILabel lbGiveMoney;

	public UILabel lbGiveExp;

	public UILabel lbGiveRep;

	public GameObject tutorialEnabler;

	public MessageBox messageBox;

	private string missionName;

	[SerializeField]
	private UIPanel widget;

	public void Awake()
	{
		base.gameObject.SetActive(true);
		if (widget == null)
		{
			widget = GetComponent<UIPanel>();
		}
		widget.gameObject.SetActive(false);
		widget.alpha = 0f;
	}

	public void Start()
	{
	}

	public void ShowWindow(bool val)
	{
		tutorialEnabler.SetActive(val);
		AimHUD.instance.ToggleAimHUD(!val);
		widget.gameObject.SetActive(true);
		MyMiniTween[] componentsInChildren = GetComponentsInChildren<MyMiniTween>();
		foreach (MyMiniTween myMiniTween in componentsInChildren)
		{
			myMiniTween.Show(val);
		}
		widget.alpha = 1f;
	}

	public void UpdateParametrMission(MissionBase needMis = null)
	{
		curMission = needMis;
		ScriptLocalization.SetMissionLocalizatiion(curMission);
		missionName = needMis.gameObject.name;
		lbTitleMis.text = curMission.title;
		lbPurposMis.text = curMission.msgPurpose;
		lbManualMis.text = curMission.msgManualStart;
		lbGiveMoney.text = curMission.CountAndAddExeptions.ToString();
		lbGiveExp.text = curMission.GiveExp.ToString();
		lbGiveRep.text = curMission.GiveReputation.ToString();
	}

	public void StartMission()
	{
		if (ManagerMissions.currMission != null)
		{
			messageBox.Show("Game_Pause/lb_mission_prigress_lost", StartNewMission);
		}
		else
		{
			StartNewMission();
		}
	}

	public void StartNewMission()
	{
		ManagerMissions.instance.StartMissionWithId(missionName, true);
	}

	public void HideMission()
	{
		ManagerMissions.instance.HideMissionWindow();
	}
}
